using System.Collections.Specialized;
using CF.Data;
using Kwan.Data;

namespace CF.Service
{
    public static class ColumnQuery
    {
        public static Expression MakeSearchWhere(NameValueCollection ps)
        {
            Expression exp = new Expression();

            string propName = "EntityID";
            if (!string.IsNullOrEmpty(ps[propName]))
                exp &= TColumn.entityID == int.Parse(ps[propName]);

            propName = "projectName";
            if (!string.IsNullOrEmpty(ps[propName]))
                exp &= TColumn.projectName == ps[propName];

            propName = "tableName";
            if (!string.IsNullOrEmpty(ps[propName]))
                exp &= TColumn.tableName == ps[propName];

            return exp;
        }
    }
}